//
//  ZFBBusinessHeaderTopCell.m
//  01-ZFB
//
//  Created by My Mac on 2017/6/7.
//  Copyright © 2017年 MyMac. All rights reserved.
//

#import "ZFBBusinessHeaderTopCell.h"
#import "ZFBBusinessHeaderTopList.h"
@interface ZFBBusinessHeaderTopCell()

@property(nonatomic,strong) UIImageView *iconView;
@property(nonatomic,strong) UILabel *nameLabel;

@end

@implementation ZFBBusinessHeaderTopCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI
{
    UIImageView *iconView = [[UIImageView alloc] init];
    iconView.image = [UIImage imageNamed:@"bus"];
    [self.contentView addSubview:iconView];
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(27);
        make.centerX.equalTo(self.contentView);
        make.top.offset(18);
    }];
    
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.text = @"美食";
    nameLabel.font = [UIFont systemFontOfSize:12];
    nameLabel.textColor = [UIColor darkGrayColor];
    [self.contentView addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(iconView);
        make.top.equalTo(iconView.mas_bottom).offset(8);
    }];
    
    _iconView = iconView;
    _nameLabel = nameLabel;
}

-(void)setHeaderTopList:(ZFBBusinessHeaderTopList *)headerTopList
{
    _headerTopList = headerTopList;
    _iconView.image = [UIImage imageNamed:headerTopList.icon];
    _nameLabel.text = headerTopList.name;
}

//高亮状态
-(void)setHighlighted:(BOOL)highlighted
{
    // 通过设置背景颜色，显示高亮效果
    UIColor *color = highlighted ? [UIColor groupTableViewBackgroundColor] : [UIColor whiteColor];
    self.backgroundColor = color;
}
@end
